$(function() {
	$("#header").load('header.html', function() {
		loadHeader(2)
	});
	$("#footer").load('footer.html', function(data, status, xhr) {});
	$("#tab").load('tab.html', function(data, status, xhr) {});
	//获取url中的参数
	function getUrlParam(name) {
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
		var r = window.location.search.substr(1).match(reg); //匹配目标参数
		if(r != null) return unescape(r[2]);
		return null; //返回参数值
	}
	//接收URL中的参数
	var id = getUrlParam('HosID');

	$.ajax({
			url: host + '/MtmlAPI/DoctorList',
			type: 'post',
			dataType: 'JSON',
			data: {
				cid: cid,
				HosID: id,
				index: 1,
				isTop: false,
				size: 100
			},

			success: function(res) {
				var doc = res.data
				if(res.state) {
					html = ''
					$.each(doc, function(i, item) {
						var pro = item.Tags.split("|").slice(0, -1);
						tabHtml = ''
						$.each(pro, function(j, tab) {
							tabHtml += `<div>${tab}</div> `
						})
						html += `
							<li onclick="location.href='doctor-produce.html?mid=${item.mid}'">
								<div class='doc-list-img' style='background-image:url(${item.HeadImage});'></div>
								<div class="doc-list-name">${item.RealName}</div>
								<div class="doc-list-intic">${item.HospitalName}</div>
								<div class="doc-list-pro">${tabHtml}</div>
							</li>
							`
					});
					$('.doctor-list').append(html)
			} else {

			}
		},
		error: function() {}
	});
})